package ${dataObject.packageName};

<#list dataObject.importPackages as pkg>
import ${pkg};
</#list>
<#if dataObject.mybatisPlus>
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
</#if>
<#if dataObject.swagger>
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
</#if>
<#if dataObject.enableLombok>
import lombok.Data;
import lombok.EqualsAndHashCode;
</#if>
<#if dataObject.lombokAccessors>
import lombok.experimental.Accessors;
</#if>

<#if !superClassName??>
import java.io.Serializable;
</#if>


/**
 * <p>
 * ${dataObject.comment!}
 * </p>
 *
 * @author ${dataObject.author}
 * @date ${dataObject.date}
 */
<#if dataObject.enableLombok>
@Data
    <#if dataObject.superClassName??>
@EqualsAndHashCode(callSuper = true)
    <#else>
@EqualsAndHashCode(callSuper = false)
    </#if>
<#if dataObject.lombokAccessors>
@Accessors(chain = true)
</#if>
</#if>
<#if dataObject.mybatisPlus>
@TableName("${dataObject.tableName}")
</#if>
<#if dataObject.swagger>
@ApiModel(value="${dataObject.className}对象", description="${dataObject.comment!}")
</#if>
<#if dataObject.superClassName??>
public class ${dataObject.className} extends ${dataObject.superClassName} {
<#else>
public class ${dataObject.className} implements Serializable {
</#if>

<#-- ----------  BEGIN 字段循环遍历  ---------->
<#list dataObject.fields as field>

    <#if field.comment!?length gt 0>
    <#if dataObject.swagger>
    @ApiModelProperty(value = "${field.comment}")
    <#else>
    /**
     * ${field.comment}
     */
    </#if>
    </#if>
    <#if dataObject.mybatisPlus>
    <#if field.pk>
    @TableId("${field.name}")
    <#else >
    @TableField("${field.columnName}")
    </#if>
    </#if>
    private ${field.type} ${field.name};
</#list>
<#------------  END 字段循环遍历  ---------->

<#if !dataObject.enableLombok>
    <#list dataObject.fields as field>
        <#if field.type == "boolean">
            <#assign getprefix="is"/>
        <#else>
            <#assign getprefix="get"/>
        </#if>
    public ${field.type} ${getprefix}${field.capitalName}() {
        return ${field.name};
    }

    public void set${field.capitalName}(${field.type} ${field.name}) {
        this.${field.name} = ${field.name};
    }
    </#list>
</#if>

<#if !dataObject.enableLombok>
    @Override
    public String toString() {
        return "${dataObject.className}{" +
    <#list dataObject.fields as field>
        <#if field_index==0>
        "${field.name}=" + ${field.name} +
        <#else>
        ", ${field.name}=" + ${field.name} +
        </#if>
    </#list>
        "}";
    }
</#if>
}
